
**This is the do file to recode Study 1 data and run the analysis**
**Import coded Stata dataset for Study 1, "Covid_PID_RAP.dta"

**treatment indicators
gen treatment=.
replace treatment=0 if TreatmentassignmentforRepublican==1
replace treatment=0 if  TreatmentassignmentforDemocrats_==1
replace treatment=0 if TreatmentassignmentforPureIndepe==1

replace treatment=1 if TreatmentassignmentforRepublica0==1
replace treatment=1 if  TreatmentassignmentforDemocrats0==1
replace treatment=1 if TreatmentassignmentforPureIndep0==1

label define treatment 0 "Bipartisan" 1 "Partisan"
label values treatment treatment 

**Partisanship indicators
gen republican=0
gen democrat=0
gen independent=0

replace republican=1 if TreatmentassignmentforRepublican==1 | TreatmentassignmentforRepublica0==1
replace democrat=1 if TreatmentassignmentforDemocrats_==1 | TreatmentassignmentforDemocrats0==1
replace independent=1 if TreatmentassignmentforPureIndepe==1 | TreatmentassignmentforPureIndep0==1


gen pid=.
replace pid=3 if republican==1
replace pid=2 if independent==1
replace pid=1 if democrat==1

label define pid 1 "Democrat" 2 "Independent" 3 "Republican"
label values pid pid

**Drop Independents (N=29) from analysis
drop if pid==2

**Recode outcome variables
gen concern=.
replace concern=1 if Q18==4
replace concern=2 if Q18==3
replace concern=3 if Q18==2
replace concern=4 if Q18==1

label define concern 1 "Not concerned at all" 2 "Not very conerned" 3 "Somewhat concerned" 4 "Very concerned"
label values concern concern


gen overreact=.
replace overreact=0 if Q19==1
replace overreact=1 if Q19==2

label define overreact 0 "Appropriate response" 1 "Overreaction"
label values overreact overreact

**Recode demographic variables 
gen white=0
replace white=1 if Q5==1

gen female=0
replace female=1 if Q7==2

gen college=0
replace college=1 if Q25>=5

gen incmiss=0
replace incmiss=1 if Q27==15

gen income=Q27
replace income=. if Q27==15
replace income=7 if incmiss==1

gen year=Q3+1900
gen age=2020-year

*Table 1

ologit concern i.treatment##i.republican 
est store m1
ologit concern i.treatment##i.republican age white female college income 
est store m2


logit overreact i.treatment##i.republican  
est store m3
logit overreact i.treatment##i.republican age white female college income 
est store m4

esttab m1 m2 m3 m4 using Table1.csv, replace nogaps ///
    title( Table 1.) b(3) se(3) starlevels(* 0.10 ** 0.05 *** 0.01 ) 


*Figure 1 produced using ggplot in R

*Appendix Table
*Balance Test - testing for covariate balance across conditions (Table A1)
logit treatment republican age white female college income if e(sample)
est store m9
esttab m9 using TableA1.csv, replace nogaps ///
    title( Table A1.) b(3) se(3) starlevels(* 0.10 ** 0.05 *** 0.01 ) 
	
*Models without interaction to address reviewer question (Table A3)	
ologit concern treatment republican
est store m5
ologit concern treatment republican age white female college income
est store m6

logit overreact treatment republican
est store m7
logit overreact treatment republican age white female college income
est store m8

esttab m5 m6 m7 m8 using TableA3.csv, replace nogaps ///
    title( Table A3.) b(3) se(3) starlevels(* 0.10 ** 0.05 *** 0.01 ) 

